export const state = () => ({
  provinceMapData: {},
  showPointData: null,
  timer: null, // 保存省份每隔5秒刷新定时器
  provinceTimer: null, // 保存省份刷新定时的timer号
  autoTimer: null
})

export const getters = {
  provinceMapData (state) {
    return state.provinceMapData
  },
  showPointData (state) {
    return state.showPointData
  },
  timer (state) {
    return state.timer
  },
  provinceTimer (state) {
    return state.provinceTimer
  },
  autoTimer (state) {
    return state.autoTimer
  }
}

export const mutations = {
  SET_PROVINCEMAPDATA (state, data) {
    state.provinceMapData = data
  },
  SET_SHOWPOINTDATA (state, data) {
    state.showPointData = data
  },
  SET_TIMER (state, timer) {
    state.timer = timer
  },
  SET_PROVINCETIMER (state, timer) {
    state.provinceTimer = timer
  },
  SET_AUTOTIMER (state, timer) {
    state.autoTimer = timer
  }
}

export const actions = {
  set_provinceMapdata ({ commit }, data) {
    commit('SET_PROVINCEMAPDATA', data)
  },
  set_showPointData ({ commit }, data) {
    commit('SET_SHOWPOINTDATA', data)
  },
  set_Timer ({ commit }, timer) {
    commit('SET_TIMER', timer)
  },
  set_ProvinceTimer ({ commit }, timer) {
    commit('SET_PROVINCETIMER', timer)
  },
  set_AutoTimer ({ commit }, timer) {
    commit('SET_AUTOTIMER', timer)
  }
}
